﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;

namespace DataForest.View.Converter
{
    class DivideConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            double width = 0;
            double divide = 2;
            if (value is double)
                width = (double)value;
            if (parameter is string)
                Double.TryParse((string) parameter, out divide);
           
            return width / divide;
          
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
